
package com.oahcfly.chgame.core;

import com.badlogic.gdx.utils.Json;
import com.oahcfly.chgame.core.event.CHEventManager;
import com.oahcfly.chgame.core.mvc.CHGame;
import com.oahcfly.chgame.plist.CHPListCenter;

/** 便捷类：快速调用其他类
 * 
 * @author haocao */
public class Chao {

	public static float gameW = -1;

	public static float gameH = -1;

	public static CHPListCenter plistCenter;

	public static CHEventManager eventManager;

	public static CHGame game;

	/**
	 * 生成json格式文本
	 * @param object
	 * @param knownType
	 * @return
	 */
	public static String toJson (Object object, Class<?> knownType) {
		Json json = new Json();
		return json.toJson(object, knownType);
	}

	/**
	 * 解析json格式文本转为对象
	 * @param text
	 * @param type
	 * @return
	 */
	public static <T> T fromJson (String text, Class<T> type) {
		Json json = new Json();
		return json.fromJson(type, text);
	}
}
